﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using moc.Common;
using moc.IBLL;
using moc.IDAL;
using moc.Models;

namespace moc.BLL
{
    public partial class ProductCommentBll :BaseBll, IProductCommentBll
    {
        private readonly IProductCommentDal _dal;
        public ProductCommentBll(IUnitOfWork unitOfWork,IProductCommentDal dal) : base(unitOfWork)
        {
            _dal = dal;
        }

        public bool AddComment(ProductComment comment)
        {
            _dal.Add(comment);
            return (_unitOfWork.SaveChanges() > 0);
        }

        public bool DeleteComments(List<ProductComment> comment)
        {
            _dal.Delete(comment);
            return (_unitOfWork.SaveChanges() > 0);
        }

        public IQueryable<ProductComment> LoadPage(PageParam param, out int total)
        {
          
         return _dal.LoadPage(param.PageSize, param.PageIndex, out total, null, u => u.Time,param.Order);
                             
        }
    }
}
